package chapter11;

/**
 * Created by V5470-I5 on 2016/4/11.
 */
public class ThreadGroupDemo2 {
    public static void main(String[] args){
        ThreadGroup group=new ThreadGroup("group");
        Thread thread1=new Thread(group,()->{
            throw new RuntimeException("thread1 测试例外");
            });
        thread1.setUncaughtExceptionHandler((thread,throwable)->{
            System.out.printf("%s:%s%n",thread.getName(),throwable.getMessage());
        });
        Thread thread2=new Thread(group,()->{
            throw new RuntimeException("thread2 测试异常");
        });
        thread1.start();
        thread2.start();
    }
}
